<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="db.TobDAO"%>
<%@page import="db.TeamDAO"%>
<%@page import="db.SubstoreDAO"%>
<%@page import="db.PlaceDAO"%>
<%@page import="db.AssignDAO"%>
<%@page import="db.Assign"%>
<%@ include file="/jsp/common/utility/logined.jsp" %>
<%
	WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
	TobDAO tobDao = (TobDAO)ctx.getBean("TobDAO");
	TeamDAO teamDao = (TeamDAO)ctx.getBean("TeamDAO");
	UserDAO userDao = (UserDAO)ctx.getBean("UserDAO");
	SubstoreDAO substoreDao = (SubstoreDAO)ctx.getBean("SubstoreDAO");
	PlaceDAO placeDao = (PlaceDAO)ctx.getBean("PlaceDAO");
	AssignDAO assignDao = (AssignDAO)ctx.getBean("AssignDAO");
	
	int uid = (Integer)session.getAttribute("id");
	User user = userDao.findById(uid);
	request.setAttribute("user",user);
	
	Assign assign = assignDao.findById(1);
	User assignUser = (User)userDao.findById(assign.getUserId());
	request.setAttribute("assignUser",assignUser);
	
	List tobList = tobDao.findAll();
	request.setAttribute("tobList",tobList);
	
	List substoreList = substoreDao.findAll();
	request.setAttribute("substoreList",substoreList);
	
	List placeList = placeDao.findAll();
	request.setAttribute("placeList",placeList);
	
	request.setAttribute("caiCode","C" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
	
	pageContext.forward("/vm/stock/addStock.vm");
%>